<?php

    // $article_id = $_GET["article_id"];

    include "./mysql.php";
    $sql = "SELECT id,user_id,content as detail,created_time as postdate,(SELECT nickname FROM t_users WHERE id = user_id) as user,(SELECT avatar FROM t_users WHERE id = user_id) as user_avatar FROM t_comments WHERE article_id = 1 ORDER BY id DESC";

    $result = $mysqli->query($sql);

    if($result->num_rows){
        while($row = $result->fetch_assoc()){
            $list[] = $row;
        }
    }else{
        $list = array();
    }
    print_r(json_encode($list));
